#!/usr/bin/python
# -*- coding: UTF-8 -*-

from Scripts.Common import EnumData

#
# the element cell data
# @author Lee
#
class Class:
    #the data name
    _name = ""
    #the data format
    _type = EnumData.UNKNOWED
    #the data value
    _value = None


    #
    # the constructed process
    # @param [dataName] the data name
    # @param [dataType] the data format
    # @param [dataValue] the data value
    #
    def __init__(self, dataName, dataType, dataValue):
        self._name = dataName
        self._type = dataType

        if EnumData.INT == self._type:
            if dataValue != "":
                self._value = int(dataValue)
            else:
                self._value = None
        elif EnumData.STRING == self._type:
            self._value = str(dataValue)
        elif EnumData.FLOAT == self._type:
            if dataValue != "":
                self._value = float(dataValue)
            else:
                self._value = None
        else:
            self._value = None
    
    #
    # Gets the data name
    # @return the data name
    #
    def GetName(self):
        return self._name

    #
    # Gets the data format
    # @return the data format
    #
    def GetType(self):
        return self._type

    #
    # Gets the data value
    # @return the data value
    #
    def GetValue(self):
        return self._value

    #
    # Checks whether the data is empty
    # @return whether the data is empty 
    #
    def IsEmpty(self):
        if EnumData.STRING == self._type:
            if "" == self._value:
                return True
            else:
                return False
        else:
            if None == self._value:
                return True
            else:
                return False

